package org.ticketing.controller;

import java.util.List;

import javax.persistence.*;

import org.ticketing.model.*;

public class EventManager {

	public void getLatestMovies() {
		EntityManagerFactory factory = Persistence.createEntityManagerFactory("DB");
		EntityManager manager = factory.createEntityManager();
		
		Query query = manager.createQuery("SELECT * FROM events"); // To change if we
			// want only a subset of films
		List<Event> events = query.getResultList();
		
		// Populate home page accordingly
	}
	
	public void getLatestPackages() {
		EntityManagerFactory factory = Persistence.createEntityManagerFactory("DB");
		EntityManager manager = factory.createEntityManager();
		
		Query query = manager.createQuery("SELECT * FROM packages"); // To change if we
			// want only a subset of films
		List<Event> events = query.getResultList();
		
		// Populate home page accordingly
	}
	
	public void getMovieData(int eventId) {
		EntityManagerFactory factory = Persistence.createEntityManagerFactory("DB");
		EntityManager manager = factory.createEntityManager();
		
		Event event = manager.find(Event.class, eventId);
		
		// Populate event's page accordingly
	}
	
}
